package com.chilly.other.collection;

import org.junit.Assert;

import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.concurrent.ConcurrentHashMap;

public class ConcurrentHashMapTest {

    public static void main(String[] args) {

        ConcurrentHashMap<String, String> map = new ConcurrentHashMap();  //初始化ConcurrentHashMap

        //新增个人信息
        map.put("id", "1");
        map.put("name", "andy");
        map.put("sex", "男");

        //获取姓名
        String name = map.get("name");
        Assert.assertEquals(name, "andy");

        //计算大小
        int size = map.size();
        Assert.assertEquals(size, 3);
//        Collections.synchronizedMap()
//        Hashtable
//        HashMap

    }

}
